package com.incar.chuxing.api;

import com.google.gson.JsonObject;
import com.incar.chuxing.base.BaseResultBean;
import com.incar.chuxing.bean.CarInfoBean;
import com.incar.chuxing.bean.CarListBean;
import com.incar.chuxing.bean.CarTrackBean;
import com.incar.chuxing.bean.CheckUserAccountBean;
import com.incar.chuxing.bean.CityBoundBean;
import com.incar.chuxing.bean.CouponCountDownBean;
import com.incar.chuxing.bean.GoldCarListBean;
import com.incar.chuxing.bean.GoldCarOneBean;
import com.incar.chuxing.bean.GoldCarTypeBean;
import com.incar.chuxing.bean.OcrOpenDoorBean;
import com.incar.chuxing.bean.OcrResultBean;
import com.incar.chuxing.bean.OperateBean;
import com.incar.chuxing.bean.RentDurationBean;
import com.incar.chuxing.bean.ResultBean;
import com.incar.chuxing.bean.ReturnCarCommentBean;
import com.incar.chuxing.bean.ReturnOilBean;
import com.incar.chuxing.bean.SendTelBean;
import com.incar.chuxing.bean.TravelDetailBean;
import com.incar.chuxing.bean.TravelDistanceBean;
import com.incar.chuxing.bean.UnFinishedOrderBean;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;

/**
 * Created by michaelpi on 2018/1/22.
 */

public interface RxApiService {


    //获取已存在的行程
    @FormUrlEncoded
    @POST("incar/v/order/get-unfinish")
    Observable<BaseResultBean<UnFinishedOrderBean>> getExistingTravel(@FieldMap Map<String, String> map);

    /**
     * 网络开车门
     */
    @FormUrlEncoded
    @POST("incar/v/car/open-car-door.json")
    Observable<OperateBean> openCar(@FieldMap Map<String, String> map, @Field("orderId") String orderId, @Field("carId") String carId, @Field("force") String force, @Field("isElectricity") String isElectricity);

    //ocr开车门
    @FormUrlEncoded
    @POST("incar/v/order/generate-Ongoing-Order")
    Observable<OcrOpenDoorBean> getOcrOpenDoor(@FieldMap Map<String, String> map, @Field("carId") String carId,
                                               @Field("isAbatement") String isAbatement, @Field("endCarTime") String endCarTime,
                                               @Field("dayNum") String dayNum,
                                              @Field("bookType") String bookType, @Field("rentType") String rentType);


    //车辆所有图标
    @GET()
    Observable<JsonObject> getAllIcon(@Url String url);


    //车辆获取-新
    @GET("ground-map/location/carList")
    Observable<CarListBean> getCars(@QueryMap Map<String, String> map, @Query("pageNo") String curPage);


    //查询车辆信息
    @GET("ground-map/location/getLocationByCarId")
    Observable<CarInfoBean> getCarInfo(@QueryMap Map<String, String> map, @Query("carId") String carId);

    //获取还车备注
    @GET()
    Observable<ReturnCarCommentBean> getReturnCarComment(@Url String url);

    //获取还车备注
    @GET("ground-map/track/getLatestPoins")
    Observable<CarTrackBean> getCarTrack(@QueryMap Map<String, String> map, @Query("carId") String carId);


    /**
     * 城市围栏
     */
    @GET("ground-fence/fence/queryFenceCoordinates")
    Observable<CityBoundBean> getFenceList(@QueryMap Map<String, String> map, @Query("version") String version);

    /**
     * 金豆车类型信息
     */
    @GET("goldbean/v1/get-params-by-area-code")
    Observable<GoldCarTypeBean> getGoldBeanTypeInfo(@QueryMap Map<String, String> map, @Query("area_code") String areaCode);

    /**
     * 金豆车列表信息
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("goldbean/v1/get-list-by-carids")
    Observable<GoldCarListBean> getGoldCarList(@Body RequestBody body);


    /**
     * 查询单个金豆车信息
     */
    @GET("/goldbean/v1/get-info-by-carid")
    Observable<GoldCarOneBean> getGoldOneCar(@QueryMap Map<String, String> map, @Query("car_id") String carId);


    //行驶中获取行驶距离
    @FormUrlEncoded
    @POST("incar/v/car/runMileage")
    Observable<TravelDistanceBean> getTravelDistance(@FieldMap Map<String, String> map, @Field("orderId") String orderId, @Field("carId") String carId);

    //行驶中获取行驶距离
    @FormUrlEncoded
    @POST("incar/v/car/carOil")
    Observable<ReturnOilBean> getOilRemain(@FieldMap Map<String, String> map, @Field("carId") String carId);


    /**
     * 动态送券
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("huodong/red_packet_person/start")
    Observable<CouponCountDownBean> getCouponCountDown(@Body RequestBody body);


    //行驶中获取订单详情
    @FormUrlEncoded
    @POST("incar/v/order/detail")
    Observable<TravelDetailBean> getTravelDetail(@FieldMap Map<String, String> map, @Field("orderId") String orderId);


    /**
     * 送车员电话
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("incar/v/preOrder/getStaffPhone")
    Observable<SendTelBean> getSendTel(@Body RequestBody body);

    /**
     * 送车上门，寻车倒计时结束通知服务器变更订单状态
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("incar/v/order/orderRunStatus")
    Observable<ResultBean> notifyOrderStatusChange(@Body RequestBody body);


    /**
     * 车牌号识别
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("recognize/v1/ocr/license_plate")
    Observable<OcrResultBean> OCRLicensePlate(@Body RequestBody body);


    /**
     * 租车时长计算
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("incar/v/account/estimatedCost")
    Observable<RentDurationBean> getRentDuration(@Body RequestBody body);


    /**
     * 租车时长计算
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("incar/v/user/checkUserMoney")
    Observable<CheckUserAccountBean> checkUserMoney(@Body RequestBody body);


}
